import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {ModalModule} from 'ngx-bootstrap';
import {FormsModule} from '@angular/forms';
import {LocationStrategy, HashLocationStrategy} from '@angular/common';

import {RequestClientService} from '../apiServices/request-client.service';
import {NormalService} from '../apiServices/normal.service';
import {AppComponent} from './app.component';
import {HomeComponent} from './home/home.component';
import {TransferHttpCacheModule} from '@nguniversal/common';
import {TopNavComponent} from './top-nav/top-nav.component';
import {LoginComponent} from './top-nav/login.component';
import {MessageModule} from './message/message.module';
import {PermissionGuard} from './permission/permission-guard';

@NgModule({
    declarations: [
        AppComponent,
        HomeComponent,
        TopNavComponent,
        LoginComponent
    ],
    imports: [
        FormsModule,
        ModalModule.forRoot(),
        BrowserModule.withServerTransition({appId: 'my-app'}),
        RouterModule.forRoot([
            {path: '', redirectTo: 'home', pathMatch: 'full'},
            {path: 'home', component: HomeComponent},
            {path: 'account', loadChildren: './+account/account.module#AccountModule'},
            {path: 'changepwd/:code/:email', loadChildren: './+changepwd/changepwd.module#ChangepwdModule'}
        ]),
        TransferHttpCacheModule,
        MessageModule
    ],
    providers: [
        {provide: LocationStrategy, useClass: HashLocationStrategy},
        RequestClientService, NormalService, PermissionGuard,
    ],
    bootstrap: [AppComponent]
})
export class AppModule {
}
